feat: New performant Block and Tx structures with raw auxiliary data. #534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During implementation our https://github.com/input-output-hk/catalyst-libs/tree/main/rust/cardano-chain-follower we have faced a necessity to decode auxiliary data by our own and not for every transaction.
Which means that if we will skip CBOR decoding for such transactions in which we are not interested in, we can increase a performance of the blockchain synchronisation.
This PR introduces a naive and a strait forward implementation and basically shows at least what we need on the
cardano-chain-followerside. So we are open to any suggestions how to change/improve this approach.Added a new
MultiEraBlockWithRawAuxiliaryandMultiEraTxWithRawAuxiliarystructures which does not actually decodeAuxiliarydata and keeps a raw bytes (replaced the usage ofKeepRaw<'b, T>with the newOnlyRaw<'b, T>).This allows in the cases where user do not want to use
pallasspecific encoding of the metadata and decode by ourselves avoid redundant decoding by pallas.With the added benchmarks
OnlyRaw<'b, AuxiliaryData>5x faster in decoding rather thanKeepRaw<'b, AuxiliaryData >:https://github.com/input-output-hk/catalyst-pallas/blob/feff0ef1ffe458d4fb61036d2290307ec67388c1/pallas-primitives/benches/alonzo_decoding.rs#L7.
Changes
MultiEraBlockWithRawAuxiliaryandMultiEraTxWithRawAuxiliary, preserving the same API as originalMultiEraBlockandMultiEraTx. Except thatMultiEraTxWithRawAuxiliarydoes not havemetadatamethod.OnlyRawstruct which skips any cobra decoding and store only original cbor raw bytes for the corresponded object.OnlyRaw<'b, AuxiliaryData>withKeepRaw<'b, AuxiliaryData >decoding.MintedBlockWithRawAuxiliaryorMintedTxWithRawAuxiliary.